package com.example.research.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
 * 审核记录实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AuditRecord {
    
    private Long id;
    
    @NotNull(message = "成果类型不能为空")
    private Integer achievementType; // 1:纵向课题 2:横向课题 3:论文
    
    @NotNull(message = "成果ID不能为空")
    private Long achievementId;
    
    @NotNull(message = "审核人ID不能为空")
    private Long auditorId;
    
    @NotNull(message = "审核状态不能为空")
    private Integer auditStatus; // 0:待审核 1:审核通过 2:审核拒绝
    
    private String auditComment;
    
    private LocalDateTime auditTime;
    
    // 关联的审核人信息
    private User auditor;
    
    /**
     * 获取成果类型描述
     */
    public String getAchievementTypeDesc() {
        if (achievementType == null) {
            return "未知";
        }
        switch (achievementType) {
            case 1: return "纵向课题";
            case 2: return "横向课题";
            case 3: return "论文";
            default: return "未知";
        }
    }
    
    /**
     * 获取审核状态描述
     */
    public String getAuditStatusDesc() {
        if (auditStatus == null) {
            return "未知";
        }
        switch (auditStatus) {
            case 0: return "待审核";
            case 1: return "审核通过";
            case 2: return "审核拒绝";
            default: return "未知";
        }
    }
}
